<template>
  <div class="business-info">
    <Divider />
    <Row justify="space-between" align="middle">
      <h3>经营信息</h3>
      <StageCom :projectStage="info.projectStage" />
    </Row>
    <h4 class="info-title">基本信息</h4>
    <Form>
      <Row class="com-form-item">
        <Col span="8">
          <FormItem label="信息类型:">{{ info.infoTypeName }}</FormItem>
        </Col>
        <Col span="8">
          <FormItem label="省份:">{{ info.province }}</FormItem>
        </Col>
        <Col span="8">
          <FormItem label="城市:">{{ info.city }}</FormItem>
        </Col>
        <Col span="8">
          <FormItem label="产业标记:">{{ info.industryAssign || info.industryMarkName }}</FormItem>
        </Col>
        <Col span="16" v-if="info.infoSource">
          <FormItem label="信息来源:">{{ info.infoSource }}</FormItem>
        </Col>
        <Col span="24">
          <FormItem label="项目地址:">{{ info.projectAddressName }}</FormItem>
        </Col>
        <Col span="24">
          <div id="allmap"></div>
        </Col>
        <Col span="24">
          <FormItem label="预计产值规模(万元):">{{ info.outputScale }}</FormItem>
        </Col>
        <Col span="24">
          <FormItem label="项目备注:">{{ info.projectRemark }}</FormItem>
        </Col>
      </Row>
      <div v-if="info.projectStage ==='BidTender'">
        <Divider />
        <h4 class="info-title">招标信息</h4>
        <Row class="com-form-item">
          <Col span="8">
            <FormItem label="资质要求:">{{ info.qualifications }}</FormItem>
          </Col>
          <Col span="8">
            <FormItem label="招标获取截止时间:">{{ info.tenderClosingDate }}</FormItem>
          </Col>
          <Col span="8">
            <FormItem label="招标截止时间:">{{ info.deadlineForBidding }}</FormItem>
          </Col>
          <Col span="8">
            <FormItem label="资金来源:">{{ info.fundingSource }}</FormItem>
          </Col>
          <Col span="8">
            <FormItem label="工程规模:">{{ info.projectScale }}</FormItem>
          </Col>
          <Col span="8">
            <FormItem label="工期要求:">{{ info.durationRequired }}</FormItem>
          </Col>
          <Col span="8">
            <FormItem label="招标范围:">{{ info.tenderScope }}</FormItem>
          </Col>
          <Col span="8">
            <FormItem label="招标控制价:">{{ info.tenderControlPrice }}</FormItem>
          </Col>
          <Col span="8">
            <FormItem label="保证金金额:">{{ info.bond }}</FormItem>
          </Col>
          <Col span="8">
            <FormItem label="缴纳保证金截止时间:">{{ info.bondEndTime }}</FormItem>
          </Col>
        </Row>
      </div>
      <Divider />
      <h4 class="info-title">联系人</h4>
      <Row class="com-form-item">
        <Col span="8">
          <FormItem label="联系人:">{{ info.contactPerson }}</FormItem>
        </Col>
        <Col span="8">
          <FormItem label="联系方式:">{{ info.contactInfomation }}</FormItem>
        </Col>
      </Row>
      <Divider />
      <h4 class="info-title">项目方</h4>
      <Row class="com-form-item">
        <Col span="8">
          <FormItem label="业主方公司名称:">{{ info.ownerCompanyName }}</FormItem>
        </Col>
        <Col span="8">
          <FormItem label="施工方公司名称:">{{ info.constructionName }}</FormItem>
        </Col>
      </Row>
    </Form>
  </div>
</template>

<script>
import StageCom from './stageCom.vue'

export default {
  name: "businessInfo",
  components: { StageCom },
  props: {
    info: {
      type: Object,
      default: () => { }
    }
  },
  watch: {
    info: {
      // immediate: true, // 立即执行 :当刷新页面时会立即执行一次handler函数
      handler (val) {
        if (val.projectName) {
          this.setMap()
        }
      }
    }
  },
  methods: {
    setMap () {
      this.$nextTick(() => {
        const { longitude, latitude } = this.info
        const map = new BMapGL.Map('allmap');
        const point = new BMapGL.Point(longitude, latitude);
        map.centerAndZoom(point, 12);
        // map.enableScrollWheelZoom(true);
        // 创建点标记
        const marker = new BMapGL.Marker(point);
        map.addOverlay(marker);
        const zoomCtrl = new BMapGL.ZoomControl();  // 添加缩放控件
        map.addControl(zoomCtrl);
      })
    }
  }
}
</script>

<style lang='less' scoped>
.business-info {
  overflow: hidden;
  #allmap {
    max-width: 1000px;
    height: 200px;
    margin: 5px 0;
    border-radius: 10px;
  }
  .info-title {
    margin: 10px 0;
  }
}
</style>
